package qianting.news.article.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import qianting.news.apis.models.article.dtos.ArticleCommentDto;
import qianting.news.apis.models.article.dtos.ArticleHomeDto;
import qianting.news.apis.models.article.pojos.ApArticle;
import qianting.news.apis.models.article.vos.ArticleCommnetVo;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface ApArticleMapper extends BaseMapper<ApArticle> {

    /**
     * 加载文章列表
     * @param dto
     * @param type  1  加载更多   2记载最新
     * @return
     */
    public List<ApArticle> loadArticleList(@Param("dto") ArticleHomeDto dto, @Param("type") Short type);

    @Update("UPDATE ap_article set static_url=#{url} where id=#{id}")
    public boolean updateStaticUrlById(Long id,String url);

    public List<ApArticle> findArticleListByLast5days(@Param("dayParam") Date dayParam);

    public Map queryLikesAndConllections(@Param("wmUserId") Long wmUserId, @Param("beginDate") Date beginDate, @Param("endDate")  Date endDate);

    List<ArticleCommnetVo> findNewsComments(@Param("dto") ArticleCommentDto dto);

    int findNewsCommentsCount(@Param("dto")  ArticleCommentDto dto);
}
